<?php

namespace app\nideshop\validate;

use think\Validate;

class GoodsValidate extends Validate
{
	/**
	 * 验证规则
	 * @var [array]
	 */
	protected $rule = [
  	'categoryId|分类id' => 'require|number',
  	'page|页数' => 'require|number',
  	'size|每页数量' => 'require|number',
    'id|商品id' => 'require',
    'keyword|搜索关键字' => 'require'
  ];


  /**
   * 查询列表验证场景
   * @Author   Yichen
   * @DateTime 2020-05-20T23:24:44+0800
   * @return   [type]                   [description]
   */
  public function sceneList()
  {
  	return $this->only(['categoryId', 'page', 'size']);
  }

  /**
   * 商品详情验证场景
   * @Author   Yichen
   * @DateTime 2020-05-22T22:04:31+0800
   * @return   [type]                   [description]
   */
  public function sceneDetail() 
  {
    return $this->only(['id']);
  }

  /**
   * 搜索帮助验证场景
   * @Author   fanzhongxing
   * @DateTime 2020-05-29T21:04:43+0800
   * @return   [type]                   [description]
   */
  public function sceneHelper() 
  {
    return $this->only(['keyword']);
  }
}